import { request } from "../request";

const token = localStorage.getItem("token");

/**
 * 验证验证码接口返回结构
 */
export interface RegisterRes {
    code: number;
    message: string;
    data: string;
    timestamp: Record<string, unknown>;
}

/**
 * 验证验证码参数结构
 */
export interface RegisterParams {
    verificationCode?: string;
    email?: string;
}

/**
 * 验证验证码
 * @param params 验证码和邮箱参数
 * @returns 验证结果
 */
export const verifyCodeAPI = async (params: RegisterParams): Promise<RegisterRes> => {
    return request(`/api/verification/auth`, {
        method: "post",
        headers: {
            "Content-Type": "application/json"
        },
        data: JSON.stringify(params)
    });
};